package com.iplay.thezen.observer;

import java.util.Vector;

/**
 * @author dangwu
 * @since 2021/9/23 6:11 下午
 */
public abstract class Subject {
    private Vector<Observer> observers = new Vector<>();

    public void addObserver(Observer o) {
        this.observers.add(o);
    }

    public void delObserver(Observer o) {
        this.observers.remove(o);
    }

    public void notifyObservers() {
        for (Observer o : observers) {
            o.update();
        }
    }
}
